const express = require("express");
const router = express.Router();
const { validate } = require("../middleware/validation");
const adminController = require("../controller/admin");
const { reg_userLogin, reg_updatePassword, reg_retrievePassword } = require("../validator/admin");

// 登录
router.post("/login", validate(reg_userLogin), adminController.login);
// 获取用户信息
router.get("/adminInfo", adminController.adminInfo);
// 退出登录
router.get("/logout", adminController.logout);
// 修改密码
router.post("/updatePassword", validate(reg_updatePassword), adminController.updatePassword);
// 获取邮箱验证码
router.post("/getEmailCode", adminController.getEmailCode);
// 找回密码
router.post("/retrievePassword", validate(reg_retrievePassword), adminController.retrievePassword);

module.exports = router;
